<script type="text/javascript">
	var form_url = '/user/add' ;
	$(function() {
		if(null != "" && "${id!}" != "") {
			form_url = '/user/update' ;
			$.get('/user/get/${id!}', function(result) {
				try {
					$('#form').form('load', result);
				} catch(e) {
					$.easyui.loaded(); console.error(e) ;
				}
			}, 'JSON').complete(function(){$.easyui.loaded();});
		}		
	});
	
	function submitForm() {
		var checkform = $('#form').form('validate');
		if(checkform) {
			$.easyui.loading();
			$.post(form_url, MM.getData('#form'), function(result) {
				try {
					if(result.code == 200) {
						$obj.reload();$window.window('close');alertify.success(result.message);
					} else {
						$.messager.alert('提示信息', result.message, 'warning') ;
					}
				} catch(e) {
					$.easyui.loaded(); console.error(e) ;
				}
			}, 'JSON').complete(function(){$.easyui.loaded();});
		}
	}
</script>

<div class="easyui-panel form-panel" data-options="border: false, fit: true">
	<form id="form" method="post">
		<input type="hidden" name="id" value="${id!}">
		<table class="table-form">
			<tr>
				<th>登录账号：</th>
				<td><input class="easyui-textbox" name="username" style="width:180px" data-options="required:true,validateOnCreate:false,validateOnBlur:true"></td>
				<th>真实姓名：</th>
				<td><input class="easyui-textbox" name="realName" style="width:180px" data-options="required:true,validateOnCreate:false,validateOnBlur:true"></td>
			</tr>
			<tr>
				<th>电子邮箱：</th>
				<td><input class="easyui-textbox" name="email" style="width:180px" data-options="required:true,validateOnCreate:false,validateOnBlur:true"></td>
				<th>手机号码：</th>
				<td><input class="easyui-textbox" name="mobile" style="width:180px" data-options="required:true,validateOnCreate:false,validateOnBlur:true"></td>
			</tr>
			<tr>
				<th>性别：</th>
				<td>
					<select class="easyui-combobox" name="gender" style="width:180px;" data-options="required:true, editable: false, panelHeight:'auto'">
		                <option value="1">男</option>
		                <option value="0">女</option>
		            </select>
				</td>
				<th>账号类型：</th>
				<td>
					<select class="easyui-combobox" name="type" style="width:180px;" data-options="required:true, editable: false, panelHeight:'auto'">
		                <option value="3">普通操作员</option>
		                <option value="2">普通管理员</option>
		                <option value="1">超级管理员</option>
		            </select>
				</td>
			</tr>
			<tr>
				<th>性别：</th>
				<td colspan="3">
					<select class="easyui-combobox" name="status" style="width:180px;" data-options="required:true, editable: false, panelHeight:'auto'">
		                <option value="1">激活</option>
		                <option value="0">禁用</option>
		            </select>
				</td>
			</tr>
			<tr>
				<th>备注信息：</th>
				<td colspan="3"><input class="easyui-textbox" name="remarks" style="width:100%;height:60px" data-options="multiline:true"></td>
			</tr>
		</table>
	</form>
</div>

<div class="submit-toolbar" id="footer"  style="border-bottom: 0;border-left: 0;border-right: 0;">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="submitForm()" style="width:80px">提交</a>
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="MM.closeCurrentWindow()" style="width:80px">关闭</a>
</div>
